package com.shushan.home.bean;

import com.android.net.bean.NetBaseBean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: StatisticsBean
 * @Desciption: //统计详情数据bean
 * @author: zhangshihao
 * @date: 2018-09-26
 */
public class StatisticsBean extends NetBaseBean {

    private List<RecordDetailBean> recordDetailBeans = new ArrayList<>();
    public TotalPlayBean totalPlayBean;

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        if(jsonObject == null){
            return;
        }

        JSONArray listArr = jsonObject.optJSONArray("list");
        if(listArr != null && listArr.length() > 0){
            for(int i=0;i<listArr.length();i++){
                JSONObject obj = listArr.optJSONObject(i);
                RecordDetailBean detailBean = new RecordDetailBean();
                detailBean.initByJson(obj);
                recordDetailBeans.add(detailBean);
            }
        }

        totalPlayBean = new TotalPlayBean();
        JSONObject obj = jsonObject.optJSONObject("all_play");
        totalPlayBean.initByJson(obj);

    }

    public List<RecordDetailBean> getRecordDetailBeans() {
        return recordDetailBeans;
    }
}
